var maxSubArray = function (nums) {
  let res = nums[0];
  for (let i = 1; i < nums.length; ++i) {
    if (nums[i - 1] > 0) {
      nums[i] += nums[i - 1];
    }
    console.log('my console i : ', nums[i]);
    console.log('my console res : ', res);
    res = Math.max(res, nums[i]);
  }
  console.log('my console result : ', res);
  return res;
};

var arr = [1, 54, 10, 1]
// var arr = [1, 6, 3, 4, 5]

// maxSubArray(arr)

function PrintMinNumber(numbers) {
  if (!numbers || numbers.length === 0) {
    return "";
  }
  return numbers.sort(compare).join('');
}

function compare(a, b) {
  const front = "" + a + b;
  const behind = "" + b + a;
  return front - behind;
}

console.log('my console PrintMinNumber(arr) : ', PrintMinNumber(arr));